home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / timidsrc.zip / COMPILE.OS2 < prev    next >
Text File  |  1997-06-03  |  5KB  |  84 lines

  1.      Notes for people who what to recompile or modify TiMidity for 
  2. OS/2. Must users will probably not be interrested in these details.
  3.  
  4.      In set this up, just extract this file into the directory where
  5. your OS/2 version of TiMidity is.  It includes everything in the
  6. primary distribution of TiMidity so you can use it to compile any
  7. version.
  8.  
  9.      To compile this you can either use the multimedia header files
  10. from the OS/2 developer's toolkit or use mm4emx version 1.1.  I've
  11. added the DART constants and structures to the original mm4emx 1.0 to
  12. create version 1.1. Remember to include the multimedia header files 
  13. from the developer's toolkit you must define INCL_MCIOS2, but for 
  14. mm4emx you must define INCL_OS2MM.
  15.  
  16.      The first time you run make it will make the depends file. This 
  17. will eventually fail and end in an error. However, now that a depends 
  18. files when you run make again it will proceed to compile TiMidity. By 
  19. commenting or uncommenting the OS/2-PM interface section you can 
  20. choose if you compile the text or PM interface. They both will output 
  21. into the file timidity.exe or you'd best make a copy before you 
  22. compile the other type.
  23.  
  24.      To compile the SLang interface you'll need the port for OS/2.
  25. It's at the slrn for OS/2 homepage at
  26. http://www.bgnett.no/~bjoff/slrn.html Hints to compile this:  mkMake
  27. is a DOS program so start up a DOS prompt to use it (you can't really
  28. re-compile it, because it needs SLang).  Move the makefile generated
  29. in to the slang\src directly and make it.  Move the slang.a file into
  30. your \emx\lib directory and the slang.h and slcurses.h in your
  31. \emx\include directory.
  32.  
  33.      The .rc has been generated with the University Resource Editor.
  34. You don't need to the URE to edited the .rc file.  It can be done by
  35. hand.  If you did to use the URE you'll need to make a few changes to
  36. the .rc file it generates.  You need to remove the directory referance
  37. from the icon resource (You have to do this every time, or the rc
  38. compiler won't compile), add FCF_TASKLIST to the end of MAINWIN's 
  39. flag list and remove SLS_BUTTONSRIGHT from the POSSLIDER flags. The 
  40. files timigood.rc has all the changes done (as does the timidity.rc in
  41. the distrabution).
  42.  
  43.      In the PM interface there are several places where it converts
  44. lenghts of time from one unit to another.  These units are often very
  45. precise (As in 1/50000th of a second) and while they fit into 32 bit
  46. numbers by themselves converting them from one format to another
  47. involves multiplying and dividing by some large constants.  That
  48. creates, temporarily, a very large number.  One that can't fit into 32
  49. bits.  CPUs are designed take then into account by allowing the
  50. results of multiplications and dividends to stretch across 2 words (64
  51. bits in two registers).  However, compilers don't allow you to do then
  52. because it might produce unexpected results.
  53.  
  54.      Overcoming this involves a bit of assembler.  The gnu compiler
  55. comes with an assembler, because one uses it itself, so you don't need
  56. any more software.  What I did is create the small file muldivor.c
  57. which just contains a function to multiply two numbers and then divide
  58. that my a third.  I took that file and compiler it to assembler with
  59. the command gcc -S -O2 muldivor.c.  This generates the assembler file
  60. muldivor.s.  You can take a look at it.  It's not that hard to fallow
  61. if you know even a little about assembly.  You can see that it does
  62. the imull instruction, clears the edx register by xoring it with
  63. itself, and then does the division.  The edx register is where the
  64. upper 32 bits of the multiplication is stored.  All you have to do is
  65. remove the xor instuction.  The imull instruction is actually a signed
  66. multiplication, which is not what we are really doing, so you can
  67. change that instruction to mull.  If you do that you also must remove
  68. the %eax from them end because with the mull instruction you can't
  69. give the destination register.  The destination is always eax:edx.
  70. Basically the instruction becomes "mull 12(%ebp)".  The file divmul.s
  71. contains all these changes.  Make will just assemble it into an object
  72. file it for you when you compile TiMidity.
  73.  
  74.      The TiMidity, being cross platform, was designed so you could 
  75. fairly easily add new interfaces to it. Once I created the PM 
  76. interface to interface with TiMidity I found things could work both 
  77. ways. It was not fairly easy to add new players to the PM interface. 
  78. How it works in the function play checks if a file is a MIDI file or
  79. not. If it is it runs play_midi_file, the TiMidity function to plays 
  80. the file with TiMidity. As TiMidity cycles it runs ctl_read which 
  81. checks the message queue and reacts appropriately. It it's not a MIDI 
  82. file it will run the function playmmos2file which plays the MMOS/2 
  83. file and handles messages.
  84.